window.onload=function(){
    shop2_get();//渲染商品数据
    shop1_get();
    shop3_get();
    document.getElementsByName("checkbox_all")[0].onclick=checkall;//绑定全选按钮
    document.getElementsByName("checkbox_all")[1].onclick=checkall;//绑定全选按钮
    checkbox();//商品
    checkbox_shop();//商店
    shop_calc();
    // document.getElementById("zzq").onclick=this.product_put;
    bindBtn();//绑定加入购物车按钮
    // bgc_change();
};
function bgc_change(){
    var inputs=document.getElementsByClassName("shop_check");
    for(var i=0;i<inputs.length;i++){
        if(inputs[i].getAttribute("name")=="checkbox"){
            inputs[i].addEventListener("change",function(){
                if(this.checked){
                    this.parentNode.parentNode.style.background="#fff4e8";
                }else{
                    this.parentNode.parentNode.style.background="#fff";
                }
            })
        }
    }
}
var shop2={
    "num_1":{"name":"莫斯利安","message":"光明 莫斯利安 常温酸奶酸牛奶(原味)350g*6盒/礼盒装","price":"34.80","img":"img/莫斯利安_big.png"},
    "num_2":{"name":"牛肉","message":"科尔沁 休闲肉铺零食 内蒙古特产 手撕风干孜然味400g","price":"79.90","img":"img/牛肉.png"},
    "num_3":{"name":"德芙","message":"德芙Dove巧克力分享碗装 什锦牛奶榛仁葡萄干巧克力 婚庆 糖果 礼品 休闲","price":"32.90","img":"img/德芙_03.png"},
    "num_4":{"name":"播放器","message":"网易云音乐车载蓝牙播放器 车载充电器 一拖二USB车充 汽车车载mp3音乐","price":"119.00","img":"img/播放器_03.png"},
};
console.log(shop2["num_1"]["price"]);
function shop2_get(){//渲染商品数据
    for(var x in shop2){
        var dom=document.getElementsByClassName("shop_pic"+x.split("_")[1])[0];
        var name=x;
        var message=shop2[x]["message"];
        var price="￥"+shop2[x]["price"];
        var img=shop2[x]["img"];
        dom.getElementsByTagName("img")[0].setAttribute("src",img);
        dom.getElementsByTagName("img")[0].setAttribute("alt",name);
        dom.getElementsByClassName("shop2_div")[0].innerHTML=message;
        dom.getElementsByClassName("shop2_price")[0].innerHTML=price;
        dom.dataset.test=x;
    }   
};
var shop1={
    "num_1":{"name":"莫斯利安","message":"光明 莫斯利安 常温酸奶酸牛奶(原味)350g*6盒/礼盒装","brief":"莫斯利安350g*6盒/原味","price":"34.80","img":"img/莫斯利安.png","weight":"4.72kg"},
    "num_5":{"name":"水晶米","message":"福临门 东北大米 水晶米 中粮出品 大米5kg","brief":"水晶米5kg","price":"27.90","img":"img/福临门大米.png","weight":"5kg"},
};
function shop1_get(){
    var arg="shop_jdzy"
    create_shop(arg);
    create_shoplist();
    create_shoplist();
    var i=0
    for(var x in shop1){
        var dom=document.getElementsByClassName("shop_jdzy")[0];
        var name=x;
        var message=shop1[x]["message"];
        var price=shop1[x]["price"];
        var brief=shop1[x]["brief"];
        var img=shop1[x]["img"];
        var weight=shop1[x]["weight"];
        dom.getElementsByTagName("img")[i].setAttribute("src",img);
        dom.getElementsByTagName("img")[i].setAttribute("alt",name);
        dom.getElementsByClassName("shop_message")[i].innerHTML=message;
        dom.getElementsByClassName("shop_price")[i].innerHTML="￥"+price;
        dom.getElementsByClassName("shop_c_span")[i].innerHTML=brief;
        dom.getElementsByClassName("shop_total")[i].innerHTML="<p>￥"+price+"</p>"+"<p>"+weight+"</p>";
        dom.getElementsByClassName("shop_del")[i].onclick=shopDel; 
        i++;
    }
}
var shop3={
    "num_6":{"name":"生鲜","message":"[2份9折，3份8折] 悦胜 海南马鲛鱼整条切片 2斤装 冷冻鲅鱼段","brief":"","price":"118.00","img":"img/鱼肉.png","weight":"2kg"},
};
function shop3_get(){
    var i=0;
    for(var x in shop3){
        var dom=document.getElementsByClassName("shop_yueshen")[0].getElementsByClassName("shop_list")[0];
        var name=x;
        var message=shop3[x]["message"];
        var price=shop3[x]["price"];
        var brief=shop3[x]["brief"];
        var img=shop3[x]["img"];
        var weight=shop3[x]["weight"];
        dom.getElementsByTagName("img")[i].setAttribute("src",img);
        dom.getElementsByTagName("img")[i].setAttribute("alt",name);
        dom.getElementsByClassName("shop_message")[i].innerHTML=message;
        dom.getElementsByClassName("shop_price")[i].innerHTML="￥"+price;
        dom.getElementsByClassName("shop_c_span")[i].innerHTML=brief;
        dom.getElementsByClassName("shop_del")[0].onclick=shopDel
        if(weight!=undefined){
            dom.getElementsByClassName("shop_total")[i].innerHTML="<p>￥"+price+"</p>"+"<p>"+weight+"</p>"; 
        }else{
            dom.getElementsByClassName("shop_total")[i].innerHTML="<p>￥"+price+"</p>"; 
        }
        i++;
    }
}
function checkall(){//所有商品全选
    var dom=document.getElementById("shop_choose");
    var input=dom.getElementsByTagName("input");
    if(this.checked){
        for (var i=0;i<input.length;i++){
            if(input[i].type.toLowerCase()=="checkbox"){
                input[i].checked=true;
                if(input[i].name=="checkbox"){
                    input[i].parentNode.parentNode.style.background="#fff4e8";
                }
            };
        }; 
    }else{
        for (var i=0;i<input.length;i++){
            if(input[i].type.toLowerCase()=="checkbox"){
                input[i].checked=false;
                if(input[i].name=="checkbox"){
                    input[i].parentNode.parentNode.style.background="#fff";
                }
            };
        };
    };
    calc_3();
};
function checkbox_shop_all(){//当商品全选的时候 选定全选按钮
    var input2=document.getElementsByName("checkbox_shop");
    var allinput2=0;
    for(var i=0;i<input2.length;i++){
        if(input2[i].checked==true){
            allinput2+=1
        }
    }
    if(allinput2==input2.length){
        var checkall=document.getElementsByName("checkbox_all");
        for(var i=0;i<checkall.length;i++){
            checkall[i].checked=true;
        }
    }
}
function checkbox_shop_allx(){//当商品没全选的时候 取消全选按钮
    var checkall=document.getElementsByName("checkbox_all");
    for(var i=0;i<checkall.length;i++){
        checkall[i].checked=false;
    }
}
function checkbox_bind(arg){//当商品全选的时候 商店按钮选择
    var dom=arg.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("shop_ul_1")[0];
    var input=arg.parentNode.parentNode.parentNode.getElementsByClassName("shop_check");
    var allinput=0;
    for(var i=0;i<input.length;i++){
        if(input[i].checked==true){
            allinput+=1
        }
    }
    if(allinput==input.length){
        dom.getElementsByTagName("input")[0].checked=true;
    }
}
function bgc(dom){//改变背景颜色
    if(dom.checked&&dom.name=="checkbox"){
        dom.parentNode.parentNode.style.background="#fff4e8";
    }else{
        dom.parentNode.parentNode.style.background="#fff";
    }
}
function checkbox(){//商品选择
    var check=document.getElementsByName("checkbox");
    // function bgc(){
    //     if(this.checked){
    //         this.parentNode.parentNode.style.background="#fff4e8";//商品被选择后的改变背景颜色
    //         checkbox_bind(this);
    //         checkbox_shop_all();
    //     }else{
    //         this.parentNode.parentNode.style.background="#fff";
    //         var dom=this.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("shop_ul_1")[0];
    //         dom.getElementsByTagName("input")[0].checked=false;
    //         checkbox_shop_allx();
    //     }
    // };
    for(var i=0;i<check.length;i++){
        check[i].addEventListener("click",function(){
            if(this.checked){
                checkbox_bind(this);
                checkbox_shop_all();
            }else{
                var dom=this.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("shop_ul_1")[0];
                dom.getElementsByTagName("input")[0].checked=false;
                checkbox_shop_allx();
            }
            bgc(this)
        });
        check[i].addEventListener("click",calc_3);
    };
}
function calc_3(){//计算总件数，总价
    var dom=document.getElementById("shop").getElementsByClassName("shop_check");
    var total=0;
    var n=0;
    for(var x=0;x<dom.length;x++){
        var name=dom[x].getAttribute("name");
        if(name=="checkbox"){
            if(dom[x].checked){
                var price=dom[x].parentNode.parentNode.getElementsByClassName("shop_total")[0].childNodes[0].innerHTML.split("￥")[1];
                total=accAdd(total,price);
                var m=parseInt(dom[x].parentNode.parentNode.getElementsByClassName("shop_amount_number")[0].value);
                n+=m
            }
        }
    }
    document.getElementById("myTotal").innerHTML="￥"+add_0(total);
    document.getElementById("myNumber").innerHTML=n;
}
function checkbox_shop(){//商店的全选
    var check=document.getElementsByName("checkbox_shop");
    function checked(){
        if(this.checked){
            var dom=this.parentNode.parentNode.parentNode;
            var input=dom.getElementsByTagName("input");
            for (var i=0;i<input.length;i++){
                if(input[i].type.toLowerCase()=="checkbox"){
                    input[i].checked=true;
                    bgc(input[i])
                };
            }; 
            checkbox_shop_all()
        }else{
            var dom=this.parentNode.parentNode.parentNode;
            var input=dom.getElementsByTagName("input");
            for (var i=0;i<input.length;i++){
                if(input[i].type.toLowerCase()=="checkbox"){
                    input[i].checked=false;
                    bgc(input[i]);
                };
            }; 
            checkbox_shop_allx()
        }
        calc_3();
    }
    for(var i=0;i<check.length;i++){
        check[i].onclick=checked;
    };
}
function accMul(arg1,arg2){//乘法
    var m=0,s1=arg1.toString(),s2=arg2.toString();
    try{m+=s1.split(".")[1].length}catch(e){};
    try{m+=s2.split(".")[1].length}catch(e){};
    return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m);
}
function accAdd(arg1,arg2){//加法
    var r1,r2,m; 
    try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0} 
    try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0} 
    m=Math.pow(10,Math.max(r1,r2)) 
    return (arg1*m+arg2*m)/m 
} 
function accDiv(arg1,arg2){//除法
    var t1=0,t2=0,r1,r2;
    try{t1=arg1.toString().split(".")[1].length}catch(e){}
    try{t2=arg2.toString().split(".")[1].length}catch(e){}
    with(Math){
        r1=Number(arg1.toString().replace(".",""))
        r2=Number(arg2.toString().replace(".",""))
        return (r1/r2)*pow(10,t2-t1);
    }
}
function calc_1(){//计算个数
    var n=this.parentNode.getElementsByClassName("shop_amount_number")[0];
    if(this.innerHTML=="+"){
        n.value=parseInt(n.value)+1;
    }else if(this.innerHTML=="-"&&(parseInt(n.value)>1)){
        n.value=parseInt(n.value)-1;
    };
    calc_2(this);
    calc_3();
}
function shop_calc(){//绑定calc_1()
    var reduce=document.getElementsByClassName("shop_amount_reduce");
    var add=document.getElementsByClassName("shop_amount_add");
    for(var i=0;i<add.length;i++){
        reduce[i].onclick=calc_1;
        add[i].onclick=calc_1;
    }
}
function add_0(arg1){//未满2位小数补零
    var m,zero="00";
    if(isNaN(arg1.toString().split(".")[1])){
        m=0;
    }else{
        m=arg1.toString().split(".")[1];
    }
    m=(m+zero).slice(0,2);
    return parseInt(arg1)+"."+m;
}
function calc_2(i){//计算单个商品价格，重量
    var total=(i.parentNode.parentNode.parentNode.getElementsByClassName("shop_price")[0].innerHTML).split("￥")[1];
    var num=i.parentNode.parentNode.parentNode.getElementsByClassName("shop_img")[0].getAttribute("alt")
    var weight=shop[num]["weight"];
    var n=i.parentNode.getElementsByClassName("shop_amount_number")[0].value;
    console.log(n,total)
    total=accMul(n,total);
    total=add_0(total);
    if(weight!=(""&&undefined)){
        var reg=/[0-9]{1,}[.]?[0-9]*/ig;
        var reg2=/(g|kg){1}/ig
        var kg=weight.match(reg2)[0];
        weight=weight.match(reg)[0];
        weight=accMul(n,weight);
        if(kg=="g"&&parseFloat(weight)>=1000){
            weight=accDiv(weight,1000);
            kg="kg"
        };
        i.parentNode.parentNode.parentNode.getElementsByClassName("shop_total")[0].innerHTML="<p>￥"+total+"</p>"+"<p>"+weight+kg+"</p>"; 
    }else{
        i.parentNode.parentNode.parentNode.getElementsByClassName("shop_total")[0].innerHTML="<p>￥"+total+"</p>"; 
    }
}
function create_shop(){//创建商店
    var shop_jdzy=document.createElement("div");
    shop_jdzy.setAttribute("class","shop_jdzy");
    document.getElementById("shop").appendChild(shop_jdzy);
    var shop_ul_1=document.createElement("div");
    shop_ul_1.setAttribute("class","shop_ul_1");
    shop_jdzy.appendChild(shop_ul_1);
    var shop_all_1=document.createElement("div");
    shop_all_1.setAttribute("class","shop_all_1");
    shop_ul_1.appendChild(shop_all_1);
    var shop_check=document.createElement("input");
    shop_check.setAttribute("class","shop_check");
    shop_check.setAttribute("type","checkbox");
    shop_check.setAttribute("name","checkbox_shop");
    shop_all_1.appendChild(shop_check);
    var shop_brand=document.createElement("a");
    shop_brand.setAttribute("class","shop_brand img_jdhd");
    shop_brand.innerHTML="京东自营"
    shop_all_1.appendChild(shop_brand);
    var shop_cell_quan=document.createElement("a");
    shop_cell_quan.setAttribute("class","shop_cell_quan");
    shop_ul_1.appendChild(shop_cell_quan);
    var shop_all_2=document.createElement("div");
    shop_all_2.setAttribute("class","shop_all_2");
    shop_all_2.innerHTML="还差<span style='color:red;'>￥</span>免运费 去凑单>"
    shop_ul_1.appendChild(shop_all_2);
    var shop_list=document.createElement("div");
    shop_list.setAttribute("class","shop_list");
    shop_jdzy.appendChild(shop_list);
}
// function create_shop2(){//创建商店2
//     var shop_jdzy=document.createElement("div");
//     shop_jdzy.setAttribute("class","shop_jdzy");
//     document.getElementById("shop").appendChild(shop_jdzy);
//     var shop_ul_1=document.createElement("div");
//     shop_ul_1.setAttribute("class","shop_ul_1");
//     shop_jdzy.appendChild(shop_ul_1);
//     var shop_all_1=document.createElement("div");
//     shop_all_1.setAttribute("class","shop_all_1");
//     shop_ul_1.appendChild(shop_all_1);
//     var shop_check=document.createElement("input");
//     shop_check.setAttribute("class","shop_check");
//     shop_check.setAttribute("type","checkbox");
//     shop_check.setAttribute("name","checkbox_shop");
//     shop_all_1.appendChild(shop_check);
//     var shop_brand=document.createElement("a");
//     shop_brand.setAttribute("class","shop_brand img_jdhd");
//     shop_brand.innerHTML="京东自营"
//     shop_all_1.appendChild(shop_brand);
//     var shop_cell_quan=document.createElement("a");
//     shop_cell_quan.setAttribute("class","shop_cell_quan");
//     shop_ul_1.appendChild(shop_cell_quan);
//     var shop_all_2=document.createElement("div");
//     shop_all_2.setAttribute("class","shop_all_2");
//     shop_all_2.innerHTML="还差<span style='color:red;'>￥</span>免运费 去凑单>"
//     shop_ul_1.appendChild(shop_all_2);
//     var shop_list=document.createElement("div");
//     shop_list.setAttribute("class","shop_list");
//     shop_jdzy.appendChild(shop_list);
// }
function create_shoplist(){//创建物品栏
    var shop_ul_2=document.createElement("div");
    shop_ul_2.setAttribute("class","shop_ul_2");
    document.getElementsByClassName("shop_jdzy")[0].getElementsByClassName("shop_list")[0].appendChild(shop_ul_2)
    var shop_choose=document.createElement("div");
    shop_choose.setAttribute("class","shop_choose");
    shop_ul_2.appendChild(shop_choose);
    var shop_check=document.createElement("input");
    shop_check.setAttribute("class","shop_check");
    shop_check.setAttribute("type","checkbox");
    shop_check.setAttribute("name","checkbox");
    shop_choose.appendChild(shop_check);
    var img=document.createElement("img");
    img.setAttribute("class","shop_img");
    shop_choose.appendChild(img);
    var shop_shop=document.createElement("div");
    shop_shop.setAttribute("class","shop_shop");
    shop_ul_2.appendChild(shop_shop);
    var shop_brand=document.createElement("a");  
    shop_brand.setAttribute("class","shop_brand");
    shop_brand.innerHTML="京东超市";
    shop_shop.appendChild(shop_brand);
    var shop_message=document.createElement("span");
    shop_message.setAttribute("class","shop_message")
    shop_shop.appendChild(shop_message);
    var shop_c=document.createElement("div");
    shop_c.setAttribute("class","shop_c")
    shop_ul_2.appendChild(shop_c);
    var shop_c_span=document.createElement("span");
    shop_c_span.setAttribute("class","shop_c_span")
    shop_c.appendChild(shop_c_span);
    var shop_price=document.createElement("div");
    shop_price.setAttribute("class","shop_price");
    shop_ul_2.appendChild(shop_price);
    var shop_amount=document.createElement("div");
    shop_amount.setAttribute("class","shop_amount");
    shop_ul_2.appendChild(shop_amount);
    var shop_calc=document.createElement("div");
    shop_calc.setAttribute("class","shop_calc");
    shop_amount.appendChild(shop_calc);
    var shop_amount_reduce=document.createElement("a");
    shop_amount_reduce.setAttribute("class","shop_amount_reduce");
    shop_amount_reduce.setAttribute("href","javascript:;");
    shop_amount_reduce.innerHTML="-";
    shop_calc.appendChild(shop_amount_reduce);
    var shop_amount_number=document.createElement("input");
    shop_amount_number.setAttribute("class","shop_amount_number");
    shop_amount_number.setAttribute("value","1");
    shop_amount_number.setAttribute("type","text");
    shop_calc.appendChild(shop_amount_number);
    var shop_amount_add=document.createElement("a");
    shop_amount_add.setAttribute("class","shop_amount_add");
    shop_amount_add.setAttribute("href","javascript:;");
    shop_amount_add.innerHTML="+";
    shop_calc.appendChild(shop_amount_add);
    var shop_total=document.createElement("div");
    shop_total.setAttribute("class","shop_total");
    shop_ul_2.appendChild(shop_total);
    var p=document.createElement("p");
    shop_total.appendChild(p);
    shop_total.appendChild(p);
    var shop_operate=document.createElement("div");
    shop_operate.setAttribute("class","shop_operate");
    shop_ul_2.appendChild(shop_operate);
    var shop_del=document.createElement("a");
    shop_del.setAttribute("href","javascript:;");
    shop_del.setAttribute("class","shop_del");
    shop_del.innerHTML="删除";
    shop_del.onclick=shopDel;
    shop_operate.appendChild(shop_del);
    var br=document.createElement("br");
    shop_operate.appendChild(br);
    var shop_zhuan=document.createElement("a");
    shop_zhuan.setAttribute("href","javascript:;");
    shop_zhuan.innerHTML="转移到我的关注";
    shop_operate.appendChild(shop_zhuan);
    var shop_list_line=document.createElement("div");
    shop_list_line.setAttribute("class","shop_list_line");
    document.getElementsByClassName("shop_jdzy")[0].getElementsByClassName("shop_list")[0].appendChild(shop_list_line);
}
function addProduct(i){//加入购物车
    var x=i.parentNode.getElementsByClassName("shop_pic_img")[0].getAttribute("alt");
    var n=document.getElementsByClassName("shop_jdzy")[0].getElementsByClassName("shop_ul_2").length
    var dom=document.getElementsByClassName("shop_jdzy")[0].getElementsByClassName("shop_ul_2")[n-1];
    var name=x;
    var message=" "+shop[x]["message"];
    var price=shop[x]["price"];
    var brief=shop[x]["brief"];
    var img=shop[x]["img"];
    var weight=shop[x]["weight"];
    dom.getElementsByTagName("img")[0].setAttribute("src",img);
    dom.getElementsByTagName("img")[0].setAttribute("alt",name);
    dom.getElementsByClassName("shop_message")[0].innerHTML=message;
    dom.getElementsByClassName("shop_price")[0].innerHTML="￥"+price;
    dom.getElementsByClassName("shop_c_span")[0].innerHTML=brief;
    dom.getElementsByClassName("shop_total")[0].innerHTML="<p>￥"+price+"</p>"+"<p>"+weight+"</p>";
}
function btn_add(){//加入购物车
    if(document.getElementsByClassName("shop_jdzy")[0]==undefined){
        create_shop();
        checkbox_shop();//绑定商店input按钮
    };
    var num=this.parentNode.getElementsByClassName("shop_pic_img")[0].getAttribute("alt");
    var shop_jdzy=document.getElementsByClassName("shop_jdzy")[0];
    var img=shop_jdzy.getElementsByTagName("img");
    var list=[];
    for(var i=0;i<img.length;i++){
        list.push(img[i].getAttribute("alt"))
    };
    if(list.indexOf(num)==-1){
        create_shoplist();//创建节点
        addProduct(this);//加入内容 
        shop_calc();//绑定加减按钮
        checkbox();//绑定input按钮
        var n=document.getElementsByClassName("shop_jdzy")[0].getElementsByClassName("shop_ul_2").length;
        var dom=document.getElementsByClassName("shop_jdzy")[0].getElementsByClassName("shop_ul_2")[n-1];
        dom.getElementsByTagName("input")[0].click();
    }else{
        shop_jdzy.getElementsByTagName("img")[list.indexOf(num)].parentNode.parentNode.getElementsByClassName("shop_amount_add")[0].click();
    }
}
function bindBtn(){//绑定加入购物车按钮
    var list=document.getElementsByClassName("addproduct");
    for(var i=0;i<list.length;i++){
        list[i].onclick=btn_add;
    }
}
function removeElement(element){//删除当前节点
    var parentElement=element.parentNode;
    if(parentElement){
        parentElement.removeChild(element);
    }
}
function shopDel(){//删除商品
    var arg=this.parentNode.parentNode.getElementsByTagName("input")[0]
    var dom=arg.parentNode.parentNode.parentNode.parentNode.getElementsByClassName("shop_ul_1")[0];
    var input=arg.parentNode.parentNode.parentNode.getElementsByClassName("shop_check");
    var list=this.parentNode.parentNode.parentNode;
    removeElement(this.parentNode.parentNode.nextSibling);
    removeElement(this.parentNode.parentNode);
    if(list.childNodes.length==0){
        removeElement(list.parentNode);
    }
    calc_3();
    var allinput=0;
    for(var i=0;i<input.length;i++){
        if(input[i].checked==true){
            allinput+=1
        }
    }
    if(allinput==input.length){
        dom.getElementsByTagName("input")[0].checked=true;
    }
}
var shop={
    "num_1":{"name":"莫斯利安","message":"光明 莫斯利安 常温酸奶酸牛奶(原味)350g*6盒/礼盒装","brief":"莫斯利安350g*6盒/原味","price":"34.80","img":"img/莫斯利安_big.png","weight":"4.72kg"},
    "num_2":{"name":"牛肉","message":"科尔沁 休闲肉铺零食 内蒙古特产 手撕风干孜然味400g",
    "brief":"牛肉干400g","price":"79.90","img":"img/牛肉.png","weight":"400g"},
    "num_3":{"name":"德芙","message":"德芙Dove巧克力分享碗装 什锦牛奶榛仁葡萄干巧克力 婚庆 糖果 礼品 休闲","brief":"巧克力200g","price":"32.90","img":"img/德芙_03.png","weight":"200g"},
    "num_4":{"name":"播放器","message":"网易云音乐车载蓝牙播放器 车载充电器 一拖二USB车充 汽车车载mp3音乐","brief":"USB车充","price":"119.00","img":"img/播放器_03.png","weight":""},
    "num_5":{"name":"水晶米","message":"福临门 东北大米 水晶米 中粮出品 大米5kg","brief":"水晶米5kg","price":"27.90","img":"img/福临门大米.png","weight":"5kg"},
    "num_6":{"name":"生鲜","message":"[2份9折，3份8折] 悦胜 海南马鲛鱼整条切片 2斤装 冷冻鲅鱼段","brief":"","price":"118.00","img":"img/鱼肉.png","weight":"2kg"},
};
// function product_put(){
//     var a = this.parentNode.getElementsByTagName("img")[0].getAttribute("alt");

//     console.log(a);
// }